package cn.itcast.com.homework.day725;

import java.util.Scanner;

/*
1. 判断一个字符串是否是回文串
例如"abc"不是对称字符串，"aba"、"abba"、"aaa"、"mnanm"是对称字符串
获取字符串使用toCharArray方法来分成数组，访问数组即可
 */
public class test1 {
    public static void main(String[] args) {
        System.out.println("请输入一段字符");
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        char[] chars = s.toCharArray();
        int length = chars.length;
        for (int i = 0; i < length / 2; i++) {
            if(chars[i]!=chars[length-1-i]){
                System.out.println("不是回文");
                break;
            }
            if(i==length/2-1){
                System.out.println("是回文数");
                break;
            }
        }


    }
}
